<%- include header%>

    <div class="article">
        <ul class="list">
            <li>
                <div><h2><%= post.title %></h2></div>
                <%if(user){%>
                    <%if(user.name == post.user.name){%>
                    <div class="edit">
                        <a href="/edit/<%= post.user.name %>/<%= post._id %>" class="edit">编辑</a> |
                        <a href="/remove/<%= post.user.name %>/<%= post._id %>" class="edit">删除</a>
                    </div>
                    <%}else if(!~post.reprint.to.findIndex(function (item) {return item.name == user.name;})){%>
                        <div class="edit">
                            <a href="/reprint/<%= user.name %>/<%= post._id %>" class="edit">转载</a>
                        </div>
                    <%}%>
                <%}%>
                <div class="info">
                    作者：<a href="/user/<%= post.user.name %>"><%= post.user.name %></a> | 日期：<%= post.time %> | 阅读:<%=post.pv%> | 评论：<%=post.comments.length%> | 转载：<%= post.reprint.to.length %>
                </div>
                <%if(post.tags.length){%>
                <div class="tags">
                    <span>标签：</span>
                    <%post.tags.forEach(function(tag){%>
                    <a href="/tag/<%=tag%>" class="tag"><%=tag%></a>
                    <%});%>%>
                </div>
                <%}%>
                <div class="post"><%- post.post %></div>
            </li>
        </ul>
    </div>

    <%if(post.reprint.from){%>
    <div class="reprintFrom info">转载自：<a href="/article/<%= post.reprint.from.name %>/<%= post.reprint.from._id %>">http://localhost/article/<%= post.reprint.from.name %>/<%= post.reprint.from._id %></a></div>
    <%}%>

    <%- include comments %>
<%- include footer%>